# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=csview
pkgver=1.2.2
pkgrel=4
pkgdesc="Pretty csv viewer for cli with cjk/emoji support"
url="https://github.com/wfxr/csview"
arch="all"
license="Apache-2.0 OR MIT"
makedepends="cargo cargo-auditable"
subpackages="
	$pkgname-bash-completion
	$pkgname-fish-completion
	$pkgname-zsh-completion
	"
source="https://github.com/wfxr/csview/archive/v$pkgver/csview-$pkgver.tar.gz
	deps.patch
	"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --frozen --release
}

check() {
	cargo test --frozen
}

package() {
	install -D -m755 target/release/$pkgname -t "$pkgdir"/usr/bin/

	install -D -m644 completions/bash/$pkgname.bash \
		"$pkgdir"/usr/share/bash-completion/completions/$pkgname

	install -D -m644 completions/fish/* -t "$pkgdir"/usr/share/fish/vendor_completions.d/
	install -D -m644 completions/zsh/* -t "$pkgdir"/usr/share/zsh/site-functions/
}

sha512sums="
b4248c7fdf22b1dc3a23eb3c2792bd05cce945a4b646500541d6927e1722be79c78aa5421b74421c35ca70ab814468db27e5bf6016a942c856568b6c1a734010  csview-1.2.2.tar.gz
445e190fa6185bdc3fb597844d9f70b50affd922c55930899306c2d7cb2cee7e0c467f93fc7df3d5e356d87e3ec063b47dab83a8a471b70bc2eff08bb2da9c56  deps.patch
"
